package com.baobao.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */
@IdClass(com.baobao.domain.NoticePK.class)
@Entity
@NamedQueries({
		@NamedQuery(name = "findAllNotices", query = "select myNotice from Notice myNotice"),
		@NamedQuery(name = "findNoticeByAuthor", query = "select myNotice from Notice myNotice where myNotice.author = ?1"),
		@NamedQuery(name = "findNoticeByAuthorContaining", query = "select myNotice from Notice myNotice where myNotice.author like ?1"),
		@NamedQuery(name = "findNoticeByContent", query = "select myNotice from Notice myNotice where myNotice.content = ?1"),
		@NamedQuery(name = "findNoticeByContentContaining", query = "select myNotice from Notice myNotice where myNotice.content like ?1"),
		@NamedQuery(name = "findNoticeByPrimaryKey", query = "select myNotice from Notice myNotice where myNotice.schoolId = ?1 and myNotice.time = ?2"),
		@NamedQuery(name = "findNoticeBySchoolId", query = "select myNotice from Notice myNotice where myNotice.schoolId = ?1"),
		@NamedQuery(name = "findNoticeBySchoolIdContaining", query = "select myNotice from Notice myNotice where myNotice.schoolId like ?1"),
		@NamedQuery(name = "findNoticeBySummary", query = "select myNotice from Notice myNotice where myNotice.summary = ?1"),
		@NamedQuery(name = "findNoticeBySummaryContaining", query = "select myNotice from Notice myNotice where myNotice.summary like ?1"),
		@NamedQuery(name = "findNoticeByTime", query = "select myNotice from Notice myNotice where myNotice.time = ?1"),
		@NamedQuery(name = "findNoticeByTitle", query = "select myNotice from Notice myNotice where myNotice.title = ?1"),
		@NamedQuery(name = "findNoticeByTitleContaining", query = "select myNotice from Notice myNotice where myNotice.title like ?1") })
@Table(catalog = "baobaodb", name = "notice")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "bb/com/baobao/domain", name = "Notice")
public class Notice implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "school_id", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String schoolId;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "time", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Calendar time;
	/**
	 */

	@Column(name = "title", length = 150)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String title;
	/**
	 */

	@Column(name = "summary", length = 300)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String summary;
	/**
	 */

	@Column(name = "author", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String author;
	/**
	 */

	@Column(name = "content", length = 6000)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String content;

	/**
	 */
	public void setSchoolId(String schoolId) {
		this.schoolId = schoolId;
	}

	/**
	 */
	public String getSchoolId() {
		return this.schoolId;
	}

	/**
	 */
	public void setTime(Calendar time) {
		this.time = time;
	}

	/**
	 */
	public Calendar getTime() {
		return this.time;
	}

	/**
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 */
	public String getTitle() {
		return this.title;
	}

	/**
	 */
	public void setSummary(String summary) {
		this.summary = summary;
	}

	/**
	 */
	public String getSummary() {
		return this.summary;
	}

	/**
	 */
	public void setAuthor(String author) {
		this.author = author;
	}

	/**
	 */
	public String getAuthor() {
		return this.author;
	}

	/**
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 */
	public String getContent() {
		return this.content;
	}

	/**
	 */
	public Notice() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Notice that) {
		setSchoolId(that.getSchoolId());
		setTime(that.getTime());
		setTitle(that.getTitle());
		setSummary(that.getSummary());
		setAuthor(that.getAuthor());
		setContent(that.getContent());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("schoolId=[").append(schoolId).append("] ");
		buffer.append("time=[").append(time).append("] ");
		buffer.append("title=[").append(title).append("] ");
		buffer.append("summary=[").append(summary).append("] ");
		buffer.append("author=[").append(author).append("] ");
		buffer.append("content=[").append(content).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((schoolId == null) ? 0 : schoolId.hashCode()));
		result = (int) (prime * result + ((time == null) ? 0 : time.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Notice))
			return false;
		Notice equalCheck = (Notice) obj;
		if ((schoolId == null && equalCheck.schoolId != null) || (schoolId != null && equalCheck.schoolId == null))
			return false;
		if (schoolId != null && !schoolId.equals(equalCheck.schoolId))
			return false;
		if ((time == null && equalCheck.time != null) || (time != null && equalCheck.time == null))
			return false;
		if (time != null && !time.equals(equalCheck.time))
			return false;
		return true;
	}
}
